/*
 * Time.java
 * Team qq 2011
 */
package com.google.code.timetrail.backend;

import java.io.Serializable;

/**
 * This class keeps track of where the ship is in time
 * and will trigger visiting different locals based on where
 * the ship is in time
 * 
 * It also keeps track of "turns traveled"
 * 
 * @author Steven
 * @version 1.0
 * 
 */
public class Time implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 70L;

	/** The amount of time traveled, compare to distance in other things */
	private int timeTraveled;
	
	/** The amount of "turns" the ship has traveled for */
	private int turn;
	
	/**
	 * Starts the player off at no turns and no days traveled
	 */
	public Time(){
		
		timeTraveled = 0;
		turn = 0;
	}
	
	/**
	 * Increments the time traveled by a predetermined amount
	 * @param amount the amount to increase the time traveled by
	 */
	public void incrementTimeTraveled(int amount){
		setTimeTraveled(getTimeTraveled() + amount);
	}
	
	/**
	 * Increment the turn count by one
	 */
	public void incrementTurn(){
		incrementTurn(1);
	}
	
	/**
	 * Increment the turn count by a selected amount
	 * @param amount the turns to increment by
	 */
    public void incrementTurn(int amount){
    	setTurn(getTurn() + amount);
    }
    
	/**
	 * sets the amount of time that has been traveled
	 * @param timeTraveled the wanted amount of time traveled
	 */
	public void setTimeTraveled(int timeTraveled){
		this.timeTraveled = timeTraveled;
	}
	
	/**
	 * sets the amount of turns that have been traveled
	 * @param turn the turn you want to set the game to
	 */
	public void setTurn(int turn){
		this.turn = turn;
	}
	
	/**
	 * Gets the amount of time that has been traveled during the game
	 * @return time traveled by the party
	 */
	public int getTimeTraveled(){
		return timeTraveled;
	}
	
	/**
	 * Returns the turn your party is on, it's analogous to days
	 * @return the current turn the game is on
	 */
	public int getTurn(){
		return turn;
	}
	
	/**
	 * The toString for the time class
	 * @return the turns and time traveled in a string
	 */
	@Override
	public String toString(){
		return getTurn() + " turns played with " + getTimeTraveled()
				+ " time-miles traveled.";
	}
}
